Modeling complex environments using an interconnected system of simulation layers

ABSTRACT

A method is provided for creating or evolving a virtual environment with a computer system. Steps of the method include: forming a plurality of layers of data, including a first layer and a second layer, each layer including a plurality of cells containing data corresponding to a variable; operating on the data from the cells in the first layer with a function to yield target data; distributing the target data to corresponding cells in the second layer; and altering the data in at least one of the plurality of cells in each layer according to a rule.

STATEMENT OF RELATED APPLICATIONS

This application is a divisional of U.S. Pat. No. 8,554,525, whichissued on Oct. 8, 2013, which claims the benefit of U.S. ProvisionalPatent Application Ser. No. 60/741,512, filed Nov. 30, 2005, entitled“Modeling Complex Computer Behavior Using an Interconnected System ofSimulation Layers”, which application is incorporated by reference inits entirety herein.

FIELD OF THE INVENTION

The invention relates to systems and methods for modeling complexenvironments using a computer, and in particular for creating artificialenvironments that evolve according to predetermined rules.

BACKGROUND OF THE INVENTION

Modern computer games demands increasing amounts of complex content inthe form of virtual environments, ecologies, and interconnected systems.As a result, professional game designers and artists are required tospend significant time and expense hand-creating such content, e.g., theartwork, textures, layouts, and procedures that form virtualenvironments.

After such efforts are expended, the resulting virtual environment,because it has been “hard-coded” into the system, is often static,unchanging, and does not respond greatly to player interaction.

Some attempts at simulating environments have been made by way ofcellular automata. However, such attempts are limited at least in partby the rules governing cellular automata.

SUMMARY OF THE INVENTION

A system and method are provided for modeling complex behavior such asvirtual environments using a computer. The system and method employ aninterconnected system of simulation layers, each running rulesets andpipes that functionally interconnect layers.

The systems and methods allow emergent environment behavior without“hard coding” such behavior into the application. In one implementation,a system models a virtual environment using multiple layers, where eachlayer includes a grid of cells, each having a set of abstract datastored within. The data in each cell corresponds to the variable thelayer is modeling. Each layer is then connected by one or more pipes toother layers. The pipes take data, usually a single value, from a sourcelayer and use the same in a function or calculation, the results ofwhich are delivered into a target layer. In this way, the values in onelayer bear a relationship to the values in another, as they would in arealistic environment. Piped data may be applied and used incalculations in at least one and sometimes several layers. Piped datamay also be abstracted to allow the value to be reapplied to the same orto different data types.

In this way, a virtual environment, e.g., an ecological system, may berapidly modeled and may serve as the basis for a graphic renderingengine to simulate complex behaviors such as water flow, grass growth,and cloud formation.

In one aspect, the invention is directed towards a method for creating avirtual environment with a computer system. Steps of the method include:forming a plurality of layers of data, including a first layer and asecond layer, each layer including a plurality of cells containing datacorresponding to a variable; operating on the data from the cells in thefirst layer with a function to yield target data; distributing thetarget data to corresponding cells in the second layer; and altering thedata in at least one of the plurality of cells in each layer accordingto a rule. In another aspect, the invention is directed to acomputer-readable medium having computer-executable instructions forperforming these steps.

Implementations of the method may include one or more of the following.An emitter or drain may be provided increases or decreases,respectively, the value of data in a cell. The rule for a given cell mayuse data in cells adjacent to the given cell. The operating step mayinclude multiplying the value of a datum in the cell in the first layerby a scalar and adding the value to the value of the corresponding datumin the cell in the second layer, and inserting the sum into the cell inthe second layer. An initial value may be set for each of the cells ineach layer, and the initial value may be zero, in which case an emittermay be provided to increase the value of data in at least one cell. Agrowth pattern may be provided for each layer. At least one of the cellsof the plurality may include data corresponding to an external agent,such as an external artificial intelligence agent or a player character.The number of cells in the first layer may be equal to the number ofcells in the second layer, and the distributing step may constitute aone-to-one mapping. Alternatively, the number of cells in the firstlayer may be not equal to the number of cells in the second layer, andin that case the distributing step constitutes a spreading of data froma cell in the first layer to a plurality of cells in the second layer.The data in each cell may include a food value and a population value,and the altering step may include spreading population values to anearest neighbor cell only if the total population and food in a cell isgreater than in the nearest neighbor cell. Moreover, the data in eachcell may include a food value and a population value, and the alteringstep may include spreading population values to each of the nearestneighbor cells. The altering step may occur at a tick rate, where thetick rate of the first layer is not equal to the tick rate of the secondlayer. The altering step may also include: dividing at least one layerof the plurality into a plurality of overlapping sublayers, wherecertain cells are duplicated in more than one sublayer; sending the datafrom each sublayer to separate slave processors along with the rule;receiving the altered data from each sublayer back from the slaveprocessors; and combining the sublayers and discarding duplicate data tocreate one layer containing altered data.

In another aspect, the invention is directed to a method of evolving avirtual environment with a computer system, the virtual environmenthaving a plurality of layers of data including a first layer and asecond layer, each layer including a plurality of cells containing datacorresponding to a variable. Steps of the method include; operating onthe data from the cells in the first layer with a function to yieldtarget data; distributing the target data to corresponding cells in thesecond layer; and altering the data in at least one of the plurality ofcells in each layer according to a rule. In another aspect, theinvention is directed to a computer-readable medium havingcomputer-executable instructions for performing these steps.

Implementations of the method may include one or more of the following.The virtual environment may be a massively multiplayer online game, andthe data in at least one cell in at least one layer may be dependent onthe actions of at least one player character.

In a further aspect, the invention is directed to a computer-readablemedium having computer-executable modules including a layer creationmodule, for creating at least a first layer and a second layer, thelayers each including a plurality of cells, each cell having at leastone data value. Another module is a pipe creation module, for creating apipe that operates on the data from the cells in the first layer with afunction to yield target data that is then distributed in the secondlayer.

In yet a further aspect, the invention is directed to a method ofcommunicating data relating to a virtual environment between a serverand a client, the virtual environment having a layer of cells of datacorresponding to a variable. Steps of the method include, on the server,altering a datum in a first cell of a layer according to data in cellsadjacent to the cell; sending the altered datum to a client; on theclient, resolving the altered datum into at least two cellscorresponding to the first cell; and displaying the at least two cells.

Implementations of the method may include one or more of the following.The method may further comprise: on the server, altering a datum in asecond cell adjacent the first cell; sending the altered datum from thesecond cell to the client; on the client, resolving the altered datumfrom the second cell into at least two cells corresponding to the secondcell; and displaying the at least two cells corresponding to the secondcell, where the values of the data of the at least two cellscorresponding to the first cell, and the values of the data of the atleast two cells corresponding to the second cell, are determined atleast in part by interpolation between the values of the data in thefirst and second cell.

In yet a further aspect, the invention is directed to a method forcreating a virtual environment including external agents with a computersystem. Steps of the method include forming at least one layer of data,the layer including a plurality of cells, each cell containing datacorresponding to a variable; altering the data in at least one cell ofthe plurality according to a rule; and altering the data in at least onecell of the plurality according to the external agent.

Implementations of the method may include one or more of the following.An initial value may be set for each of the cells in each layer, and theinitial value may be zero, in which case an emitter may be provided toincrease the value of data in at least one cell. An artificial barriermay be configured across at least a portion of the layer such that novalues can transfer or spread across the artificial barrier.

In yet a further aspect, the invention is directed to a method ofevolving a virtual environment with a computer system, the virtualenvironment incorporating an external agent and having at least onelayer of data, the layer including a plurality of cells, each cellcontaining data corresponding to a variable. Steps of the methodincluding: altering the data in at least one cell of the pluralityaccording to a rule, and altering the data in at least one cell of theplurality according to the external agent.

Implementations of the method may include one or more of the following.The altering the data in at least one cell of the plurality according tothe external agent step may include altering the data according to theproximity of the external agent to the cell. The step of altering thedata in at least one cell of the plurality according to the externalagent may include altering the data according to the value of a variableassociated with the external agent. The external agent may be a playercharacter or a non-player character in a multiplayer online game, may bean emitter or a drain. The data may correspond to a food value or apopulation value. The rule may be an expansion rule.

Advantages of a system according to certain embodiments of the inventionmay include one or more of the following. Individual objects such asanimals, plants, bodies of water, snow drifts, players, paths, etc. arecombined in a cohesive model with cross-interaction at a level limitedonly by the imagination of the model builder. Without assigning specialattributes to areas or objects, features and objects acquirecharacteristics and responses with considerable depth. For example, ifplant health and growth reacts to the amount of activity occurring in anarea, then cow-paths will form where players and animals commonly walk,and isolated spots will develop undergrowth. To “inject” the activity ofplayers into the model, a ruleset has only to refer to a model-externalsource such as a database or game server and set cell valuesaccordingly. Alternatively, actors outside of the model can assert aneffect on the model by increasing or decreasing values, e.g., an actorharvesting fish in an area removes a number of fish from a cell. Modelelements can also “exject” into the game: a game server may beprogrammed to start a wildfire in a particular location based on thedensity of plants and the dryness of the soil.

Another advantage of a system according to certain embodiments of theinvention is that predators and prey act and perform naturally withoutcomplex artificial intelligence (“AI”) programming. For example, thesame will flee, hide, and follow each other based on attraction to orrepulsion from corresponding values in the modeled system. The behavioris natural, emergent, and dependent on many aspects of the model. Forexample, a player-induced rainstorm may cause a chain effect, causingsoil moisture to increase, subsequent plant growth, attraction ofherbivores, and the subsequent stalking of the area by predators.

A further advantage of a system according to certain embodiments of theinvention is that when a user combines the components of a conceptualsubsystem of the overall model into one layer with a set of rules thatgoverns its evolution, the invention facilitates the modularization ofthat subsystem. For example, the water cycle or temperature can becomplex single layers with many values which may be readily associatedwith a terrain layer or other module in order to re-use sophisticated,well-designed subsystems and rapidly build model environments.

Yet a further advantage of a system according to certain embodiments ofthe invention is that the system is not limited by the rules of cellularautomata. Features such as pipes, emitters, drains, scrolling, and thelike provide considerable advantages in virtual environment creationover the features available in cellular automata systems.

Other advantages will be apparent from the following description,including the figures and claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a two-layer system according to an embodiment of theinvention in which the layers are connected by pipes. A detailed view ofa cell is also shown.

FIG. 2 shows a data flow diagram of a multi-layer system, showing pipesconnecting certain of the layers, and the subsequent rendering anddisplay of the resulting combined data.

FIG. 3 shows a flowchart of a process manager that controls and directsthe distribution of rule processing for each cycle in a distributedprocessing system.

FIG. 4 shows how the process manager of FIG. 3 divides layers intooverlapping sublayers for distributed processing.

FIG. 5 shows an exemplary user interaction scenario, in which a usercreates a virtual environment employing an embodiment of the invention.

FIG. 6 shows a client/server architecture that may be employed with theinvention, where the data on the client side has higher resolution thanthe corresponding data on the server side.

DETAILED DESCRIPTION

The following definitions are provided.

A “layer” is a grid or matrix of connected cells, and may even consistof a single cell. The grid may be two-dimensional, such that the cellsare disposed in a plane. The layer may also be three-dimensional. Layersare often rectangular, but other layouts are possible, such astriangular, circular, or an arbitrarily complex geometric area. Eachlayer represents a feature or variable of the environment to be modeled:water, ground terrain, water vapor, clouds, reeds, fish, animals, etc.Layers are generally finite, but may be very large and may appear toextend indefinitely in some embodiments. Within a layer, a rule orruleset may be defined to change values in reaction to, or taking intoaccount the value of, neighboring cells. Referring to FIG. 1, two 3×3layers are shown, a first layer 11 and a second layer 13. Layer 11 hascell 10 in the center and four neighboring cells 10′, 10″, 10′″, and10″″. The four neighboring cells are termed “nearest neighbor” cells.The four corner cells are termed next-nearest neighbor cells. A rule istypically defined to take account of values in the nearest neighborcells, although some rules may also take account of thenext-nearest-neighbor cells as well, or even more distant cells. For asubstantially square layer oriented like a map, the extremes of thelayer may be considered to be its northern, southern, eastern, andwestern edges.

A “cell” is a discreet unit within a layer. Cells contain discretepackets of one or more data values, each labeled by a user or bydefault. Referring again to FIG. 1, the detailed view of cell 10″ isshown having a number of values, including value A of 0.0, value B of3.335, and value C of 1.0. Other values may also be included. Typically,two values are included, and this is enough for many models. Forexample, a cell may have values that correspond to terrain and water, orreeds and fish, etc. In the absence of user-defined labels, the valuesmay be termed “food” and “population”. In many cases, when there is a“food” value and a “population” value in a cell, the “food” value may beconsidered as changing slowly, while the “population” value can beconsidered as being more dynamic, or changing more rapidly. In general,all cells in a layer are usually of the same type, e.g., all cells havethe same number of values with the same labels.

A “rule” or “ruleset” or an “algorithm” is any mathematical expressionwhich may take current or adjacent cell values, or both, as inputvariables. Rules are used to evolve the cell values within a layer. Cellvalues in other layers are usually not considered as input variables;rather, the effects of these are transmitted via pipes. External datasources may be considered, however, such as databases, look-up tables,etc. A single rule may be applied to multiple layers of cells, andmultiple rules may be applied to any layer. One exemplary rule may be“if food value is greater than 2, increase population by 1”.

An “emitter” is a combination of a “flux” value and a position, and istied to a particular layer. Emitters are used to add a constant value toeach cell in an area each cycle. As an example, an emitter may model ageyser or rain, which adds water to the surface ground layer in a realecological system. An emitter may serve to control the simulation model,e.g., to start or end the same, or simply to influence the simulation. Anegative emitter is termed a “drain” and can be employed to deduct aconstant value from each cell. For example, a drain may be added toforce water out of a layer to make certain that user-specified areas arenot swamped.

“Growth” is a scalar value that affects the value of each cell in alayer each cycle. For example, a growth specification of “Water, 0.6”scales, in this case reduces, each Water value down by 40% each cycle(1×0.6=0.6, a 40% reduction). Growth specifications like this cansimulate factors such as evaporation, drainage, erosion, natural growth,rainfall, or similar concepts of general loss or gain.

A “pipe” is generally a function that connects or “maps” a group ofsource layer cells with target layer cells. In more detail, a pipe isoften a combination of a scalar value, an input layer and value type,and an output layer and value type. For example, referring to FIG. 1,pipes 30 are shown which connect a “source” or first layer 11 with a“target” or second layer 13. Generally, each pipe affects every cell inthe output layer. In one embodiment, when a pipe is processed, a valuein the input layer cell is multiplied by a scalar value and added to avalue in the output layer cell. Pipes are used to propagate values fromone layer to another. For example, a pipe may be used to map a layer ofcells having “water” values to a layer of cells having “cloud” values.Such a pipe would simulate evaporation of water on the land whichbecomes water vapor in the air.

Because pipes connect layers, the orientation and position of one layerrelative to another becomes important. Each pipe may include thisorientation information. In a case where two layers have the sameposition and the same cell dimensions, then a one-to-one mapping isstraightforward. In a case where the layers have different positions anddifferent dimensions, however, a pipe may include an integer offset intwo dimensions, and a scale. The layers are aligned, e.g., by theupper-left-most cell of each layer, and then scaled, and then offset bythe specified value or values. The offset allows mismatched size layersto be situated relative to each other, and the scale allows mismatchedsize layers to translate from one size to another. For example, thescale can be used to map a 100×100 cell layer to a 2000×2000 cell layer,spreading the pipe of the 100×100 layer over the 2000×2000 layer. Otherways of mapping one layer to another may also be employed. In an extremecase, a single cell on one layer may be piped or mapped to all the cellson a target layer, or all the cells in one layer may be mapped to asingle cell in the target layer.

Referring back to FIG. 1, the pipe 30 may have the following exemplaryfunctionality: pipe 30 takes the value of population in layer 11, times0.40, and adds the product to the value in layer 13, and the sum thenreplaces the prior value in layer 13. The first cell in layer 11 isdenoted L11[1,1] and the corresponding cell in layer 13 is denotedL13[1,1]. The food values in those cells are denoted Food(L11[1,1]) andFood(L13[1,1]). If the initial value of Food in the first cell of thefirst layer is 10, such that Food₀(L11[1,1])=10, and the initial valueof Food in the first cell of the second layer is 1, such thatFood₀(L13[1,1])=1, then the effect of the pipe is to changeFood(L13[1,1])=Food₀(L13[1,1])+0.4*Food₀(L11[1,1])=1+0.4*10=1+4=5.

A problem may arise with cells on the edge of the layer, which lack acomplete set of nearest neighbor cells. In this case, the calculationsmay take into account the values of the cells along the opposite edge.In other words, with regard to cells along an edge of the layer, e.g.,the southern edge, the nearest neighbor line of cells, south of thesouthern edge layer, may be arbitrarily chosen to be the northern edgeof cells. In this way, the values can scroll out of one edge and intothe opposite edge.

Example One

As a first example, referring to FIG. 2, a system is shown that modelsvegetation, e.g., grass and the flow of various kinds of water overterrain. Three layers are shown: a water/ground layer 12, agrass/moisture layer 14, and a clouds/air layer 16. In layer 12, the“food” is ground, and the “population” is water. In layer 14, the “food”is moisture, and the “population” is grass. In layer 16, the “food” isair pressure, and the “population” is clouds.

Various pipes are also shown that connect the layers together. A pipe 18connects layer 12 to layer 14. This pipe 18 maps water to moisture, andcreates the food source necessary, i.e., moisture, for grass to exist onlayer 14. Another pipe 22 connects layer 12 with layer 16. This pipe 22maps water loss to clouds, and simulates evaporation of water on theland which then becomes water in the air or clouds. Yet another pipe 24connects layer 16 with layer 12. This pipe 24 maps cloud loss, e.g.,condensation, to water, and simulates the return of water from the airback to land.

Other pipes could also be employed, but are not shown here as theyrepresent second- and higher-order effects. For example, moisture mayalso evaporate and thus lead to an increase in the cloud value.

The overall water population values are used to create a water rendering26. Similarly, the overall ground population values are used to create aground rendering 28, the overall grass population values are used tocreate a grass rendering 32, and the overall cloud population values areused to create a cloud rendering 34. With regard to a rain rendering 36,this may be developed by examining the rate at which the cloudpopulation decreases, i.e., by examining the cell values piped betweenthe cloud layer back to the terrain layer. The renderings 26-36 are thencombined to create the overall screen display 38. More details ofgraphic renderings are provided below.

As noted above, each layer may have its own set of scalar terms, orrules, that control the rates of increase and decrease in each of thebasic values of food and population. One class of rules pertains togrowth rates. As examples, a food growth rate is the rate of change forevery food value. A population growth rate is the amount of populationthat will grow from a quantity of food. The population growth rate isnot the increase in the population itself, but rather how much iscreated from the paired food value. The food consumption rate is therate at which food disappears based on population. The population deathrate is the rate at which population disappears.

A set of expansion rules is defined to allow the food and populationvalues to move from one cell to another. A first expansion rule is thatpopulation values in a cell will spread to their nearest neighbors onlyif the total population and food in the cell is greater than the totalpopulation and food in neighbor cells. This rule simulates, e.g., fluidmoving off higher-terrain areas to lower-terrain areas. A secondexpansion rule is that population values spread to the nearest-neighborcells, e.g., those that are east, west, north, and south of the subjectcell.

For both rules, conservation of values is used. For example, if asurplus amount from a source cell is distributed, it is done so in anequal manner among the target cells, and the value in the source cell isdecremented accordingly. In the above example, the first rule may beused in layer 12 to simulate water movement on the ground, the secondrule may be used in layer 14 to simulate the spread of grass, and thefirst rule may be used in layer 16 to simulate the spread of water vaporalong air currents.

In the above example, cell values in each layer are adjusted each cycleaccording to the rules defined for that layer. Simple rules may include,e.g., “subtract 1 from Food”, “multiply Food value by 0.88”, “set Foodvalue to the average Food value of all neighbors”, “increase Moisture byten times the sine of the current cycle number”, etc. A more complicatedexample might be “compute the current value of cell water by searchingfor ‘displacement’ of neighboring cells, according to a simple fluidmovement model based on height of land and depth of water in adjacentcells”. Configurations of the system may be used to model, e.g., theflow of water or accumulation of snow over terrain, the migration ofanimals between food sources, the spread and health of plant life overterrain, etc.

Example Two

As another example, to model the migration of animals between foodsources, e.g., fish in water, a configuration with just two layers issufficient. The bottom layer is the “terrain/water” layer, having valuesof Height and Water. The top layer is the “reeds/fish” layer, havingvalues of Reeds and Fish.

As examples of initial conditions, the bottom layer's Height values areinitialized with a “height map” of terrain, which describes the height,e.g., above sea level, of each point in the terrain. The bottom layer'sWater values are initialized with a flat, high value. The top layers'Reeds values are initialized to zero and its Fish values may be randomlyset.

The model may also be given rules such as the bottom layer's Heightvalues remain unchanged for all cycles. This layer may also be given arule which causes the Water values to “flow” downhill.

A pipe from the bottom layer to the top layer may be added, whichincreases the top layer's Reeds values according to the amount of Waterin the bottom layer. If there is too much Water, e.g., more than 6.0,the Reeds value is zero. If there is too little Water, e.g., less than2.0, the Reeds value is again zero. Between those values, Reeds may beset on a smooth curve from a value of zero to one and back to zero. Asecond rule may also be added which sets the top layer's Fish value tozero if there is too little Water, e.g., less than 0.5.

The top layer may be given a rule that “flows” Fish values towards thosecells which contain the most Reeds. Fish, in integral quantities, may bemoved from their current cells to neighboring cells that contain morefood. This simulates a real system in which fish are only aware of theimmediate area around them. This technique also allows different groupsof fish to accumulate in different local maxima.

A similar rule may take into account the consumption of food by thefish. Fish in a cell will consume food from the cell, thus making thecell less desirable to the fish, and causing them to migrate in searchof richer food sources in successive iterations of the simulation.Further complexity could be added, e.g., placing a maximum on the fishpopulation in a given cell, thus preventing overcrowding.

As this example evolves, the water will settle downhill, the reeds willsettle at the edges of the water, and the surviving fish will movetowards the highest concentration of reeds. Reeds are consumed by thefish, which then migrate to other patches of reeds, while the reedsslowly grow back over time.

Initial conditions may be set in several ways. First, initial conditionsmay be set by seeding each layers initial food values using, e.g.,Perlin noise. Another way is to import “maps” of food values. Forexample, grayscale bitmaps of terrain may be imported for initialterrain or ground states. Corresponding bitmaps of clouds over terrainmay be employed for the cloud initial states.

In one implementation, to model water flow, the user may specify asinitial conditions the dimensions of a virtual terrain, the contour ofthe terrain, i.e., the height at each point, starting water depths onthe terrain, and a simple rule for altering water depth values in termsof height values.

In another implementation, the initial population conditions may besimply set at zero, and emitters employed to start populations in themodel. For example, an emitter may be used in the above example tocreate a source of water in layer 12. For the reasons discussed above inconnection with the definition of emitters and drains, a drain may beemployed to remove water from a user-specified area. In the example, anywater removed from layer 12 is automatically disposed in layer 16. Oncein layer 16, the water will follow its own expansion rules, e.g., alongair current values, and may encounter drains that eventually dispose thewater back into layer 12.

One simple way of seeding the layers is by use of a functionaldistribution of population or food values, or both. For example, asimple sine wave distribution may be employed to seed the initialvalues. Such an implementation would be especially useful where theentire evolutionary process, i.e., the evolution from an essentiallyblank landscape, is not pertinent to gameplay or is otherwise not ofinterest.

Additional features may be provided to make the virtual environment evenmore interesting. One additional feature that may be added to models isan artificial barrier. Layers may be inserted with artificial barriersto prevent movement and spread of certain values, as might be expectedof a man-made wall, force field, radii of radioactive or toxicinfluence, design-dictated “safe space”, etc.

Further features that may be added to models are growth patterns forpopulations. These growth patterns provide for a small chance ofspontaneous population growth. Dynamic systems with elements that changein response to one another can wander into imbalance, where someelements are permanently destroyed, even with a model that is on averageself-sustaining. To facilitate the self-healing of such models, thegrowth pattern for populations may be inserted. In this way, every cellwith a positive food value has a predetermined, usually small, chance oneach cycle of generating a population value for that same cell. Thus,for example, even a relatively simple model of soil and grass, in whichall the grass has been eaten by herbivores, can spontaneously create newgrass where the conditions are suitable.

The method by which data values in all cells are updated can vary. Oneimplementation alters the data values in every cell “at once”, indiscrete time slices, according to the rules employed. The rules wouldbe applied to each cell individually, according to its neighboring cellsas appropriate, and according to the pipes. A “cycle time” may beemployed, which is the unit of time during which rules and pipescalculate new values for each cell individually, and then replaces thevalues of all data items in all cells with the new values beforecompleting the cycle.

The engine for the system, e.g., the game engine, has a base cycle ratetermed here a “tick”. The tick may be related to the processor clock.Layers may have individual update rates, which are based on these ticks.Each layer may also have a property of an “update rate”, which theengine uses to determine how often to process that layer. For example,one layer may have a “tick-1” and another layer a “tick-3”. In thiscase, the first layer would run three times as often as the secondlayer.

One global way to configure the engine is by setting the “frame rate”target for the tick. This may be set by a user to some number of, e.g.,milliseconds, that the engine uses as a gauge to determine how fast torun. For example, a frame rate of 100 ms means that the engine willcompute a tick and be ready to begin the next tick 100 ms later. Userscan employ and adjust the frame rate and the tick system for layers toapproximate a model speed, so that the system may be run as rapidly oras slowly as desired.

The order of operation of the engine is as follows:

  For each model cycle,  For each layer,   For each rule,    Determinethe new value for each cell.   End rule  Update all cells with their newvalues.  End layer  For each emitter,   Determine the new value for eachcell.   Update all cells with their new values.  End emitter  For eachpipe,   Determine the new value for each cell in the target layer.  Endpipe  For each growth value,   Determine the new value for each cell.  Update all cells with their new values.  End growth value End cycle.

Of course, the above ordering is merely exemplary. The exact ordering isconfigurable by the user. For example, pipes may be processed beforerules for a given model.

Before or after each cycle, the engine may save or export the state ofany cell, layer, or model for visualizers or external applications touse or display. The engine may also save its data at any time to avoidrecalculating in the event of interruption. This feature is useful forlarge models, with many layers, cells, pipes, and rules.

External systems may interact with the model to extract information, toinject or alter values in the model, and to alter the model'sparameters.

One type of external system that interacts with the model is an animalagent system. This is a type of AI that controls the behavior of animalagents in a virtual environment. The environment itself is modeled bysystems as have been described, and the AI system provides an animalagent subsystem that acts on the virtual environment by, e.g., changingthe values of a variable in a cell. In other words, the model definesthe behavior of the environment and the AI system defines the behaviorof the animals. For example, an AI agent may be a caribou. The caribouhas a location that corresponds to a location in the virtualenvironment, e.g., a position on the terrain of the model. The AI agentmay query the model for information about the locality of theenvironment, such as the health and quantity of grass in the area and inthe surrounding areas. The AI agent system then makes a decision thatwill in turn impact the virtual environment, e.g., such as the caribouchoosing to eat a portion of the grass. If the caribou chooses to do so,then the change in the grass population would be injected into themodel. On the next cycle, the grass in the cell will be depleted, whichin turn has other consequent effects, such as on the moisture of thesoil. Any agents that query for the status of the grass in that cellwill find that the same has been depleted.

Another type of external interaction with the system is other playercharacters. In particular, in a multiplayer environment, playercharacters operated by other players may affect food and populationvalues in a cell by, e.g., consuming food, causing the other playercharacters to leave the cell, etc. Such interactions impart anoften-desired additional layer of complexity to the model or virtualenvironment. In a massively multiplayer online (“MMO”) game, suchexternal agents may have a considerable impact on resources andgameplay.

One configuration of the system has more than one software processcomputing the values, per the rules or pipe functions, for the changesin cell values. In this distributed mode, the work of calculating acycle is split among multiple processors. A central, controllingprocessor, the process manager, directs the distributed computation andholds the “complete” model after each cycle.

Referring to FIG. 3, a flowchart is shown of the process manager thatcontrols and directs the distribution of rule processing for each cyclein a distributed processing system. In the distributed processingsystem, the process manager is called (step 42) and the cycle starts(step 44).

First, a check is made as to whether there are rules to be processed(step 46). If so, the process manager determines how many slaveprocessors it has available for distributed processing (step 48). Theprocess manager then splits the layers into sublayers with overlappingor “slop” zones (step 52). The slop zone account for the need to computecell values based on nearest-neighbor cells, as is described below. Thesublayers are usually of equal size, though they need not be, especiallyin the case where the slave processors are of differing capabilities. Asa typical example, a 30×30 layer may be split into three 10×30sublayers.

Referring to FIG. 4, a schematic diagram is shown of how the processmanager of FIG. 3 divides layers into overlapping sublayers fordistributed processing. In this case, a simple example is shown of a 3×3layer 66 being sectioned into two overlapping 3×2 sublayers 68 and 72.Layer 66 contains cells A1-A3, B1-B3, and C1-C3. Sublayer 68 containscells A1, B1, and C1, as well as A2, B2, and C2. Sublayer 72 containscells A3, B3, and C3, as well as A2, B2, and C2.

In this way, each sublayer is buffered with a slop zone of configurablesize, which is usually one row or column of cells. This slop zone servesto expand the sublayer into its neighbors. In FIG. 4, slop zones 74 and76 each contain cells A2, B2, and C2. In the case of the 30×30 grid, thesublayers would be expanded into 11×30, 12×30, and 11×30 sublayers, suchthat each sublayer overlaps into neighbors by one row or column ofcells.

The purpose of the slop zone is to allow each slave processor access tocells neighboring the cells for which it is responsible for computingvalues, as rules and algorithms often compute the value of a cell basedon the values of its nearest neighbors. The slop zone may be made largerif cells beyond nearest-neighbors are to be included in the calculation.

In one implementation, the process manager performs the majority of theprocessing for each cycle locally, and only employs distributedprocessing when rules are applied, as rule application typicallyrequires the most intensive processing.

The process manager assigns each slave processor a sublayer and a rule.It sends the rule and the specification for each cell in the sublayer toeach processor (step 54). The slave processors then perform therequested rule calculations on their assigned sublayers (step 56). Theprocess manager waits for each slave to return a calculated sublayerwith the rule applied (step 58). Errors are also handled in this step.The process manager then combines the sublayers back into a singlelayer, discarding slop zone duplicate cells. If no more rules remain tobe run (the “NO” branch of step 46), the cycle can end (step 62) and thestate can be saved (step 64).

Various methods or protocols can be used by which the process managerand the slave processor can communicate. For example, communication maybe accomplished with a custom TCP/IP protocol, SOAP, RMI, inter-processcommunication methods such as named pipes or shared memory ordistributed shared memory, CORBA, or the like.

In a related implementation, instead of each slave processor beingassigned a sublayer and a rule during each cycle, and transferring theentire specification of each sublayer to the slave and back to theprocessor, each processor is assigned “ownership” of a sublayer. In thismode, the process manager holds the slop zone contents and coordinatesthe values of slop zone cells between slave processors. It synchronizesthe operation of the model and may query slave processors at any time toreceive a “snapshot” of the global state of the model or of any sublayeror subsection of a sublayer.

In a further related implementation, one of the slave processors thatmay be employed is the graphics processing unit. This may be aparticularly advantageous choice for the following reasons. The CPU isthen not taxed with computing additional parts of the simulation. Inaddition, it is noted that hardware cards generally employ a graphicprocessing unit that works with textures. Every cell of the texture, or“texel”, is a value within a certain range that corresponds to the colorvalue at that location. So layers according to embodiments of thepresent invention may be treated as texture surfaces. This texture maythen be passed into, e.g., a pixel shader code which contains thealgorithm needed. The results of this pixel shader code are written to adestination render target which is just another texture. Each cell inthis final texture contains the results of the algorithm. Since graphicsprocessing units are optimized for such work on textures, leveragingthis processor to perform the algorithm computations provides anincrease in total processing power.

Embodiments of the invention have been described as ways to create avirtual environment that evolves. Users can create these modelenvironments either by total specification, e.g., a database,spreadsheet, XML file, text file, system properties, etc., or byinteraction through a graphical interface.

In more detail, one implementation is as a service or system, e.g.,executable software, available to an online game server infrastructure.In this implementation, the system would be well-suited to long-termmodeling and persistent-state worlds that change over time, and can addmuch complexity to such an environment with an independent process andrelatively modest processing requirements. In addition, because thevalues being modeled are easily abstracted, the system is reusable, andcan work as a “toolkit” component that can plug into a variety ofdifferent server architectures and fulfill a variety of differentmodeling roles.

Another implementation is as a design tool, allowing a user to create amuch more believable environment on a much more rapid time scale thantraditional modeling or world-design tools. Even if the finishedenvironment does not have the system itself incorporated into thegameplay, or has entirely different quantities being modeled duringgameplay than were modeled during content creation, the finishedenvironment still benefits from the believability, consistency, and easeof content creation allowed by such a complex simulation. Such animplementation is particularly suited for single-player orshort-duration games, where the long-term effects of, e.g., water flow,plant growth, or erosion may not have time to be noticed.

Referring to FIG. 5, a flow diagram is shown illustrating how a user maycreate or adjust a model all at once or in a step-by-step fashion. Themethod starts (step 78) and the user determines the purpose of the model(step 82). Depending on what is to be modeled, and the level ofcomplexity desired, the user determines an initial number of layers(step 84). The user then reviews if additional layers are needed (step86). If not, then the model is tested and its behavior visualized (step96). If the system works as expected (step 98) and the “YES” branchfollowing, the method ends (step 102). If the system fails to work asexpected, then a review of the layers, rules, and pipes may be performed(step 104), and the flow branches to the number of layers determination(step 84).

Returning to the decision point of if more layers are needed (the “YES”branch of step 86), for each additional layer added, specifications aremade of the layer name, number of values in each cell, and labels forthe cell values (step 88). Rules are created to govern evolution ofvariables in the layer (step 92). If necessary or desired, pipes may becreated to link the layer with other layers (step 94). The process maythen branch to the decision point of if more layers are need (step 86).

With this method, the user may edit or adjust the model at any time,including during engine execution. In this case, changes may take affectat the next cycle.

Once the system has created a simulation, model, or virtual environment,the data can be read from any or all layers and provided to a graphicspipeline.

To represent the terrain with a height field, each height pole is mappedto one terrain value in each cell, giving the shape of the terrainlandscape. A water mesh may be created in the same way. For typicalrules, the water mesh will flow and spread over the more fixed terrainlandscape.

Textures on the terrain can be associated with the grass values inanother layer. A simple look-up table of grass values rangescorresponding to different textures can be established. To provide morevariation in the mapping, a two-dimensional table of grass ranges towater ranges can be created. In this way, the texture of any polygon inthe terrain may be chosen according to how much water and grass exist inthe locality. In one exemplary system, a table of six water ranges, from“very dry” to “underwater” can give an appropriate texture to be appliedto each terrain polygon.

Along with texturing the terrain polygons, grass polygons, i.e.,polygons representing different types or amounts, or both, of grass maybe employed. A table similar to the terrain polygon table may be used toselect the texture to be applied to the grass polygon. For even moredetail, the actual value of grass may be employed to scale the grasspolygon vertically in size, e.g., to simulate grass growing or dyingout.

Examples of texturing follow. A shoreline texture may be applied on thewater mesh. As the water value of each point on the mesh is usuallyknown, shorelines may be detected by checking water and terrain valuesand a different texture applied to the water mesh polygons on theshoreline.

As noted above, water movement from layer 16 to layer 12 of FIG. 2 maybe associated with rain. A particle display system may be associatedwith this pipe 24 and thereby provide dynamic placement of rainparticles.

For even more realism, large changes in water movement from, e.g.,expansion rules, can be tracked and provide locations where to placesound markers for rushing water and babbling brooks.

In any of these cases, transitions from one polygon to an adjacent onemay be made to appear smoother by graphically “smearing” the boundarylayers of the adjacent cells. One way to do this is by a simple methodof interpolation between the adjacent variable values in order tocalculate appropriate values for placement along a boundary layer. Otherways will also be apparent given this teaching.

In some cases, the graphics processing and rendering on the server sidemay be coarse, and when transmitted to the client side may acquiregreater resolution via interpolation, smearing, etc. In this way, serverprocessing may be minimized.

For example, referring to FIG. 6, a client/server system is shown withgame engine server 106 and a client system 108. The server 106 runs thegame engine application, maintains the overall game virtual environment,and sends information to the game client 106 pertinent to the playercharacters and environment local to the client. In the figure, server106 operates on a set of data shown as nine cells A1-A3, B1-B3, andC1-C3. When client 106 receives and displays this data, the data can bedisplayed with greater resolution, e.g., cell A1 can be resolved intonine cells A11-A31, B11-B31, and C11-C31. Cells A2-A3, B1-B3, and C1-C3can be resolved similarly.

As one example of graphic smearing using interpolation, and referring tothe cells with underlined indices, the polygon type corresponding to aserver side cell may be made the same as the center cell of the set ofnine corresponding cells on the client side. For example, the polygontype of cell A1 may be made the same as the polygon type of cell B21.Similar, the polygon type of cell B1 may be made the same as the polygontype of cell B24. The cells on the client side between B21 and B24,i.e., C21 and A24, may have their polygon types determined by a smoothinterpolation between that of cells B21 and B24.

According to the present invention, as fully described above, a systemis provided to automate the creation and evolution of much of a game'scontent, including much of the game's environment. The creation andevolution are dynamic and responsive. A rule engine creates and operateson a number of layers, each layer having a number of discreet datapackets termed cells. The engine causes each cell to change over time inresponse to neighboring cells, as well as from cells in adjacent orconnected layers via pipes. This process emulates the dynamic, complex,and emergent behaviors which characterize living biological andecological systems. In such systems, the results may be complicated andmay lead to unexpected effects. To configure the system for a particularsituation, a user interacts with the implementation, likely in software,setting constraints and labels for the emulation.

While the invention has been described in the context of game contentand environments, it should be clear to one of ordinary skill in theart, given this teaching, that the invention is much broader than theembodiments shown. For example, the invention may be applied to modelingecological, biological, sociological, economic, and other such systems.Indeed, any software that models a changing or evolving system, i.e.,one with parameters that change according to rules, may benefit fromincorporation of the invention. Moreover, while the invention has beenprimarily described in the context of two-dimensional layers, and it hasfurther been noted that three-dimensional layers are possible, it shouldbe clear that a three-dimensional layer is not the same as atwo-dimensional layer with pipes connecting the layers. Rather, where athree-dimensional layer is employed, the same may also be connected viapipes to other layers, with appropriate modifications if necessary inthe mapping method. In addition, it should be noted that the termsvirtual environment, system, virtual world, ecosystem, ecologicalsystem, model, and the like have been employed substantiallyinterchangeably in this specification, the phrase chosen is dependent onthe context.

Accordingly, the scope of the invention is limited only by the claimsappended hereto.

The invention claimed is:
 1. A method for creating a computer implemented virtual environment including external agents with an online game server system having a game engine and a rule engine, comprising: forming a first layer of data and a second layer of data with the online game server system, the first layer of data including a plurality of cells, each cell containing a first datum and a second datum, the first datum corresponding to a different variable than the second datum, the plurality of cells in the first layer corresponding to a plurality of cells in the second layer; altering, with the online game server system, data in a first cell of the plurality of cells in the first layer according to a rule, wherein the altering is influenced by an external agent; in response to the altering, changing data values in at least one nearest neighbor cell of the first cell to spread a data value of the first cell within the first layer of data, the changing performed by the online game server system; operating on the data in the first cell with a function to yield target data, the operating performed by the online game server system; and distributing, with the online game server system, the target data to a corresponding cell in the second layer.
 2. The method of claim 1, further comprising setting an initial value for each value of data in each cell.
 3. The method of claim 2, wherein the initial values are all zero, and further comprising altering the data in at least one cell of the plurality using an emitter or drain.
 4. The method of claim 1, further comprising configuring an artificial barrier across at least a portion of the layer such that no values can transfer or spread across the artificial barrier.
 5. The method of claim 1, wherein altering the data in the first cell includes altering the data according to the proximity of the external agent to the first cell.
 6. The method of claim 1, wherein altering the data in the first cell includes altering the data according to the value of a variable associated with the external agent.
 7. The method of claim 1, wherein the external agent is a player character in a multiplayer online game.
 8. The method of claim 1, wherein the external agent is a non-player character in a multiplayer online game.
 9. The method of claim 1, wherein the external agent is an emitter or a drain.
 10. The method of claim 1, wherein the data in the first cell corresponds to a food value or a population value.
 11. The method of claim 1, wherein the rule is an expansion rule. 